Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax ProtocolType requirement on ProtocolObject #516

Merged
merged 3 commits into from
Dec 3, 2023
Merged

Conversation

madsmtm
Copy link
Owner

@madsmtm madsmtm commented Sep 21, 2023

Relax the ProtocolType requirement on ProtocolObject, which means we can now have protocol objects with auto traits, such as ProtocolObject<dyn NSObjectProtocol + Send>.

Protocols objects with multiple protocols are not yet possible.

Construction of these is still difficult, we'd have to somehow do impl ImplementedBy<T: Any + Combination + Of + Traits> for dyn Any + Combination + Of + Traits. But I suspect construction of these will be exceedingly rare anyhow, and at least it's better that you can use them, if icrate constructs them for you.

TODO:

  • Add changelog and documentation
  • Add tests for new functionality
  • Add UI tests for things that would be unsound

@madsmtm madsmtm added bug Something isn't working A-objc2 Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` crates A-framework Affects the framework crates and the translator for them labels Sep 21, 2023
@madsmtm madsmtm added this to the Usable icrate milestone Sep 21, 2023
@madsmtm madsmtm modified the milestones: Usable icrate, Polish icrate Dec 3, 2023
These Sized bounds are already added by the extern_protocol! macro
@madsmtm madsmtm changed the title Properly emit ProtocolObject with multiple protocols Relax ProtocolType requirement on ProtocolObject Dec 3, 2023
This allows us to do `ProtocolObject<dyn ProtocolA + ProtocolB>` in the future.
@madsmtm madsmtm marked this pull request as ready for review December 3, 2023 07:58
@madsmtm madsmtm merged commit 1af01ab into master Dec 3, 2023
19 checks passed
@madsmtm madsmtm deleted the protocol-fixes branch December 3, 2023 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-framework Affects the framework crates and the translator for them A-objc2 Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` crates bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant